package testing.comparer;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

import words.NumberStat;
import words.Quotation;

import comparer.NumberComparer;
import comparer.QuotationComparer;


public class QuotationComparerTest {
	QuotationComparer comparer;
	Quotation origin_quot;
	Quotation compared_quot;

	@Before
	public void setUp() throws Exception {
		this.comparer = new QuotationComparer();
		this.origin_quot = new Quotation();
		this.compared_quot = new Quotation();
	}
	@Test
	public void test1()
	{
		String origin[] = {"He","is","a","boy"};
		String compare[] = {"He","is","a","boy"};

		origin_quot.input(origin);
		compared_quot.input(compare);
		comparer.set_origin(origin_quot);
		comparer.set_compared(compared_quot);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test2()
	{
		String origin[] = {"He","is","a","boy"};
		String compare[] = {"He","is","not","a","boys"};

		origin_quot.input(origin);
		compared_quot.input(compare);
		comparer.set_origin(origin_quot);
		comparer.set_compared(compared_quot);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
	@Test
	public void test3()
	{
		String origin[] = {"He","is","a","boy"};
		String compare[] = {"He","is","a","boys"};

		origin_quot.input(origin);
		compared_quot.input(compare);
		comparer.set_origin(origin_quot);
		comparer.set_compared(compared_quot);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test4()
	{
		String origin[] = {"He","is","a","boy"};
		String origin2[] = {"I","am","man"};
		String compare[] = {"He","is","a","boys"};
		String compare2[] = {"I","am","man"};

		origin_quot.input(origin);
		origin_quot.input(origin2);
		compared_quot.input(compare);
		compared_quot.input(compare2);
		comparer.set_origin(origin_quot);
		comparer.set_compared(compared_quot);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,2);
	}
	@Test
	public void test5()
	{
		String origin[] = {"He","is","a","boy"};
		String origin2[] = {"I","am","man","okay","?"};
		String compare[] = {"He","is","a","boys"};
		String compare2[] = {"I","am","man"};

		origin_quot.input(origin);
		origin_quot.input(origin2);
		compared_quot.input(compare);
		compared_quot.input(compare2);
		comparer.set_origin(origin_quot);
		comparer.set_compared(compared_quot);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test6()
	{
		String origin[] = {"He","is","not","am","boy"};
		String origin2[] = {"She","is","man"};
		String compare[] = {"He","is","a","boys"};
		String compare2[] = {"I","am","man"};

		origin_quot.input(origin);
		origin_quot.input(origin2);
		compared_quot.input(compare);
		compared_quot.input(compare2);
		comparer.set_origin(origin_quot);
		comparer.set_compared(compared_quot);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
}
